<template>
  <div class="login">
    <!-- 背景图 -->
    <img
      class="login_img"
      src="http://www.pupumall.com/c5dc50453f3e13094865a79217a29b5d.png"
      alt=""
    />
    <!-- 头部 -->

    <!-- <div class="car_box"></div>
        <div class="right_top"></div> -->

    <div class="logincon">
      <div class="logincontainer">
        <router-link to="/home" tag="div" class="logo"> 菜篮子 </router-link>
        <div class="sg_box">
          <div class="tabList">
            <ul>
              <li
                :class="{ con: index == active }"
                class="current"
                v-for="(item, index) in ['用户登录', '扫码登录']"
                :key="index"
                @click="active = index"
              >
                {{ item }}
              </li>
            </ul>
          </div>
          <div class="mar-box" v-if="active === 0">
            <div class="input-box">
              <div class="input-text">
                <span class="iconfont icon-user"></span>
                <input type="text" placeholder="账号" v-model="phone" />
              </div>
              <div class="input-text">
                <span class="iconfont icon-mima"></span>
                <input type="password" placeholder="密码" v-model="password" />
              </div>
            </div>
            <div class="btn_login">
              <el-button class="btn-log" :plain="true" @click="submit"
                >登录</el-button
              >
            </div>
            <ul class="way">
              <li>
                <img src="../assets/img/1.jpg" />
                <p style="font-size: 12px">微博</p>
              </li>
              <li>
                <img src="../assets/img/2.jpg" />
                <p style="font-size: 12px">QQ</p>
              </li>
              <li>
                <img src="../assets/img/3.jpg" />
                <p style="font-size: 12px">支付宝</p>
              </li>
              <li>
                <img src="../assets/img/4.jpg" />
                <p style="font-size: 12px">微信</p>
              </li>
            </ul>
          </div>
          <div v-if="active === 1" class="ewm">
            <img src="../assets/img/And.png" alt="" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      phone: "",
      password: "",

      active: 0,
    };
  },
  methods: {
    submit() {
      // 1.验证手机号码
      let reg =
        /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
      let pass = /^[a-zA-Z0-9]\w{8,17}$/;
      // 2.验证密码
      if (!reg.test(this.phone) || !pass.test(this.password)) {
        //不正确处理
        this.$notify.error({
          message: "请输入正确手机号码与密码",
          type: "success",
        });
        return;
      }
      window.localStorage.setItem("token", "13421722866");
      window.localStorage.setItem("userId", "lin123456");
      this.$notify({
        message: "登陆成功",
        type: "success",
      });
      this.$router.push("/personal");
    },
  },
};
</script>

<style lang="scss" scoped>
.login {
  background-image: linear-gradient(135deg, #34e07b 0%, #17b356 100%);
  position: relative;
  .login_img {
    width: 100%;
    // height: 867px;
    position: absolute;
    bottom: 100px;
    // right: -15px;
    // overflow: hidden;
    filter: blur(10px);
  }

  .logincon {
    // opacity: 0.6;
    // height: 684px;
    .logincontainer {
      width: 895px;
      height: 937px;
      padding-top: 270px;
      margin: 0 auto;
      color: #515151;
      display: flex;
      justify-content: center;
      position: relative;
      .logo {
        font-family: "font";
        font-weight: 700;
        font-size: 65px;
        color: #fff;
        transform: rotateZ(355deg);
        position: absolute;
        top:115px;
        cursor: pointer;
        img {
          position: absolute;
          top: 44px;
          right: 1px;
          width: 20px;
          height: 20px;
          border-radius: 7px;
        }
        .car_box {
          margin: 0 170px;
          font-size: 35px;
          color: #fff;
          font-family: "font";
          font-weight: 700;
        }
        .right_top {
          // display: flex;
          z-index: 99;
          .home {
            color: #000;
            font-size: 22px;
            // padding-right: 70px;

            .icon-shouye-shouye {
              padding-right: 5px;
              font-size: 20px;
            }
          }
        }
      }
    }
    .con {
      border-bottom: 1px #ddd solid;
    }
    .sg_box {
      width: 600px;
      height: 400px;
      background-color: rgba(0, 0, 0, 0.55);
      border: 10px;
      padding: 20px 50px;
      border-radius: 20px;
      z-index: 1;
      .tabList {
        ul {
          display: flex;
          justify-content: space-evenly;
          li {
            color: #fff;
            font-size: 18px;
            padding-bottom: 9px;
          }
        }
      }
      .mar-box {
        margin-top: 20px;
      }
      .ewm {
        padding-top: 50px;
        width: 280px;
        height: 300px;
        margin: 0 auto;
        img {
          width: 100%;
          height: 100%;
        }
      }
      .input-box {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        // transform: translateY(-35px);
        .input-text {
          width: 100%;
          display: flex;
          justify-content: center;
          // span {
          //   color: aliceblue;
          //   font-size: 18px;
          //   margin-top: 20px;
          // }
          .iconfont {
            color: #fff;
            font-size: 27px;
            padding-top: 20px;
            margin-right: 7px;
          }
          input {
            border: 0;
            padding: 6px;
            border-bottom: 1px solid white;
            background-color: #ffffff00;
            color: #fff;
            margin-top: 20px;
            width: 230px;
            outline: none;
          }
        }
      }
    }
    input::-webkit-input-placeholder {
      color: #fff;
    }
    .remember {
      display: flex;
      justify-content: space-around;
    }

    .remember > span {
      display: flex;
      align-items: center;
    }

    .remember > a {
      color: #515151;
    }
    .btn_login {
      display: flex;
      justify-content: center;
      button {
        width: 245px;
        height: 40px;
        line-height: 40px;
        text-align: center;
        border: none;
        color: #fff;
        font-size: 15px;
        font-weight: bold;
      }

      .btn-log {
        margin-top: 25px;
        background-color: #7f0019;
      }

      .register {
        margin-top: 50px;
      }

      .btn-reg {
        background-color: #3b4a45;
      }
    }
    /* 方式 */
    .way {
      display: flex;
      justify-content: space-evenly;
      margin-top: 40px;
    }

    .way li {
      display: flex;
      align-items: center;
      flex-direction: column;
      color: #fff;
    }

    .way li img {
      width: 30px;
      height: 30px;
      margin-bottom: 8px;
      border-radius: 100%;
    }
  }
}
.el-button {
  padding: 0;
  color: #fff;
}

.el-button.is-plain:hover {
  color: #fff;
}
</style>